#include "littlefs.h"
#include <stdio.h>
#include <string.h>
#include "los_memory.h"

//目前只挂载1个  partition 未适配
int LittlefsRead(int partition, UINT32 *offset, void *buf, UINT32 size)
{
    //printf("LittlefsRead \n");
    //printf("offset:%x size:%d %d %s \n",*offset,size,__LINE__,__FILE__);
    W25Q64_read((uint8_t *)buf,*offset,size);
    return LFS_ERR_OK;
}
 
int LittlefsProg(int partition, UINT32 *offset, const void *buf, UINT32 size)
{
    //printf("LittlefsProg \n");
    //printf("offset:%x size:%d %d %s %s\n",*offset,size,__LINE__,__FILE__, buf);
    W25Q64_write((uint8_t *)buf,*offset,size);
    return LFS_ERR_OK;
}
 
int LittlefsErase(int partition, UINT32 offset, UINT32 size)
{
    //printf("LittlefsErase %d %p\n", offset , offset);
   W25x_SectorErase(offset,size);
//    W25x_SectorErase(offset, size);
    return LFS_ERR_OK;
}

int LittlefsSync(const struct lfs_config *c)
{
    //printf("LittlefsErase %d %p\n", offset , offset);
    return LFS_ERR_OK;
}
